﻿/*
 * TiffReader
 * 
 * initial implementation : 20.10.2008
 *
 * Copyright (c) Adam Sida, asida@centrum.cz.
 * All rights reserved.
 * 
 * for license see Petra.Gis.License.txt
 */
using System.IO;


namespace Petra.Gis.ImagingServices.Tiff
{
  /// <summary>
  /// represents enhanced binaryReader with endian conversion support
  /// </summary>
  public class TiffReader : BinaryReader
  {
    TiffDataEndian _dataEndian;

    public TiffReader(Stream tiffDataStream, TiffDataEndian endian)
      :base(tiffDataStream)
    {
      _dataEndian = endian;
      
    }



    public TiffDataEndian Endian
    {
      get { return _dataEndian; }
    }



    public override double ReadDouble()
    {
      return EndianConverter.ToDouble(base.ReadDouble(), _dataEndian);
    }


    public override float ReadSingle()
    {
      return EndianConverter.ToFloat(base.ReadSingle(), _dataEndian);
    }

    

    public override short ReadInt16()
    {
      return EndianConverter.ToInt16(base.ReadInt16(), _dataEndian);
    }

    public override ushort ReadUInt16()
    {
      return EndianConverter.ToUInt16(base.ReadUInt16(), _dataEndian);
    }

    public override int ReadInt32()
    {
      return EndianConverter.ToInt32(base.ReadInt32(), _dataEndian);
    }

    public override uint ReadUInt32()
    {
      return EndianConverter.ToUInt32(base.ReadUInt32(), _dataEndian);
    }


  }
}
